<template>
  <div class="app-container">
    <el-form  @submit.native.prevent :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="案卷题名" prop="maintitle">
        <el-input
          v-model="queryParams.maintitle"
          placeholder="请输入案卷题名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="档号" prop="folderNo" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.folderNo"
          placeholder="请输入档号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="js">-->
<!--        <el-input-->
<!--          v-model="queryParams.js"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="folderLocation">-->
<!--        <el-input-->
<!--          v-model="queryParams.folderLocation"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="密级" prop="securityClass">-->
<!--        <el-select v-model="queryParams.securityClass" placeholder="请选择密级" clearable>-->
<!--          <el-option-->
<!--            v-for="dict in dict.type.security_dict"-->
<!--            :key="dict.value"-->
<!--            :label="dict.label"-->
<!--            :value="dict.value"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
      <el-form-item label="全宗号" prop="fondsNo" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.fondsNo"
          placeholder="请输入全宗号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="contentNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.contentNo"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="filingYear">-->
<!--        <el-input-->
<!--          v-model="queryParams.filingYear"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="保存期限" prop="retention">-->
<!--        <el-select v-model="queryParams.retention" placeholder="请选择保存期限" clearable>-->
<!--          <el-option-->
<!--            v-for="dict in dict.type.save_dict"-->
<!--            :key="dict.value"-->
<!--            :label="dict.label"-->
<!--            :value="dict.value"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
      <el-form-item label="分类号" prop="archiveCtgNo" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.archiveCtgNo"
          placeholder="请输入分类号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="案卷号" prop="yearFolderNo" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.yearFolderNo"
          placeholder="请输入案卷号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="形成单位" prop="xcdw" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.xcdw"
          placeholder="请输入形成单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="quantity">-->
<!--        <el-input-->
<!--          v-model="queryParams.quantity"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="docStartTime">-->
<!--        <el-input-->
<!--          v-model="queryParams.docStartTime"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="docEndTime">-->
<!--        <el-input-->
<!--          v-model="queryParams.docEndTime"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="关键字" prop="sbtWord">-->
<!--        <el-input-->
<!--          v-model="queryParams.sbtWord"-->
<!--          placeholder="请输入关键字"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="归档时间" prop="pigeonholeDate">-->
<!--        <el-input-->
<!--          v-model="queryParams.pigeonholeDate"-->
<!--          placeholder="请输入归档时间"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="note">-->
<!--        <el-input-->
<!--          v-model="queryParams.note"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="蓝图张数" prop="ltzs">-->
<!--        <el-input-->
<!--          v-model="queryParams.ltzs"-->
<!--          placeholder="请输入蓝图张数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="底图张数" prop="di">-->
<!--        <el-input-->
<!--          v-model="queryParams.di"-->
<!--          placeholder="请输入底图张数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="文字材料张数" prop="wjcl">-->
<!--        <el-input-->
<!--          v-model="queryParams.wjcl"-->
<!--          placeholder="请输入文字材料张数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->

      <el-form-item label="总卷号" prop="zjh" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.zjh"
          placeholder="请输入总卷号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="danr">-->
<!--        <el-input-->
<!--          v-model="queryParams.danr"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="项目地址" prop="xmdz" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.xmdz"
          placeholder="请输入项目地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="编制日期" prop="bzrq">-->
<!--        <el-input-->
<!--          v-model="queryParams.bzrq"-->
<!--          placeholder="请输入编制日期"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="移交单位" prop="yjdw" v-if="showAdvanceSearch">
        <el-input
          v-model="queryParams.yjdw"
          placeholder="请输入移交单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="案卷数" prop="gj">-->
<!--        <el-input-->
<!--          v-model="queryParams.gj"-->
<!--          placeholder="请输入案卷数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="卷标" prop="dj">-->
<!--        <el-input-->
<!--          v-model="queryParams.dj"-->
<!--          placeholder="请输入卷标"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="档案馆代号" prop="dagdh">-->
<!--        <el-input-->
<!--          v-model="queryParams.dagdh"-->
<!--          placeholder="请输入档案馆代号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="nyr">-->
<!--        <el-input-->
<!--          v-model="queryParams.nyr"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="xiangmdw">-->
<!--        <el-input-->
<!--          v-model="queryParams.xiangmdw"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="engId">-->
<!--        <el-input-->
<!--          v-model="queryParams.engId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="yuliuA">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuliuA"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="yuliuB">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuliuB"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="是否绑定电子工程 0为未绑定  1 为绑定旧版电子工程 2为新版电子工程" prop="yuliuC">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuliuC"-->
<!--          placeholder="请输入是否绑定电子工程 0为未绑定  1 为绑定旧版电子工程 2为新版电子工程"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="yuliuD">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuliuD"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button type="success" icon="el-icon-sort" size="mini" @click="toggleSearchMode">{{
            showAdvanceSearch ? '收起高级搜索' : '展开高级搜索'
          }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-plus"-->
<!--          size="mini"-->
<!--          @click="handleAdd"-->
<!--          v-hasPermi="['system:old:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"

        >修改案卷信息</el-button>
      </el-col>
<!--      v-hasPermi="['system:old:edit']"-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          plain-->
<!--          icon="el-icon-delete"-->
<!--          size="mini"-->
<!--          :disabled="multiple"-->
<!--          @click="handleDelete"-->
<!--          v-hasPermi="['system:old:remove']"-->
<!--        >删除</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['system:old:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table ref="multipleTable" @row-click="handleRowClick" height="750" max-height="610" style="margin-top:10px" v-loading="loading" :data="oldList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="总卷号" align="center" prop="zjh" />
      <!--      <el-table-column label="主键" align="center" prop="recid" />-->
      <el-table-column label="档号" align="center" prop="folderNo" width="150"/>
      <!--      <el-table-column label="${comment}" align="center" prop="js" />-->
      <el-table-column label="案卷题名" align="center" prop="maintitle" width="400"/>
      <el-table-column label="归档时间" align="center" prop="pigeonholeDate" width="100"/>
      <el-table-column label="形成年度" align="center" prop="filingYear" width="80"/>
      <el-table-column label="分类号" align="center" prop="archiveCtgNo" width="80"/>
      <el-table-column label="案卷号" align="center" prop="yearFolderNo" width="100"/>
      <el-table-column label="卷标" align="center" prop="dj" width="60"/>
      <el-table-column label="案卷数" align="center" prop="gj" width="60"/>
      <el-table-column label="文件数量" align="center" prop="quantity" width="80"/>
      <el-table-column label="形成单位" align="center" prop="xcdw" width="300"/>
      <el-table-column label="移交单位" align="center" prop="yjdw" width="230"/>
      <el-table-column label="项目地址" align="center" prop="xmdz" width="150"/>
      <el-table-column label="文字材料张数" align="center" prop="wjcl" width="100"/>
      <el-table-column label="蓝图张数" align="center" prop="ltzs" width="80"/>
      <el-table-column label="底图张数" align="center" prop="di" width="80"/>
      <el-table-column label="密级" align="center" prop="securityClass" width="100">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.security_dict" :value="scope.row.securityClass"/>
        </template>
      </el-table-column>
      <el-table-column label="保存期限" align="center" prop="retention" width="100">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.save_dict" :value="scope.row.retention"/>
        </template>
      </el-table-column>
      <el-table-column label="全宗号" align="center" prop="fondsNo" width="100"/>
      <el-table-column label="编制日期" align="center" prop="bzrq" width="200"/>
      <!--      <el-table-column label="${comment}" align="center" prop="contentNo" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="docStartTime" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="docEndTime" />-->
      <el-table-column label="关键字" align="center" prop="sbtWord" width="100"/>
      <!--      <el-table-column label="${comment}" align="center" prop="note" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="archiveEntityStatus" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="danr" />-->
      <el-table-column label="档案馆代号" align="center" prop="dagdh" width="100"/>
      <el-table-column label="位置" align="center" prop="folderLocation" width="100"/>
      <!--      <el-table-column label="${comment}" align="center" prop="nyr" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="xiangmdw" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="engId" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="yuliuA" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="yuliuB" />-->
      <!--      <el-table-column label="是否绑定电子工程 0为未绑定  1 为绑定旧版电子工程 2为新版电子工程" align="center" prop="yuliuC" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="yuliuD" />-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"

          >修改</el-button>
<!--          v-hasPermi="['system:old:edit']"-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['system:old:remove']"-->
<!--          >删除</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改旧案卷操作对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1700px" append-to-body>
      <!-- 在对话框中显示选中的数据 -->
      <el-form  @submit.native.prevent ref="form" :model="form" :rules="rules" label-width="90px">
        <el-row :gutter="20">
          <el-col :span="6">
            <!-- 第一列-->
            <el-form-item label="总卷号" prop="zjh">
              <el-input v-model="form.zjh" placeholder="请输入总卷号" />
            </el-form-item>
            <el-form-item label="档号" prop="folderNo">
              <el-input v-model="form.folderNo" placeholder="请输入档号" />
            </el-form-item>
            <el-form-item label="案卷题名" prop="maintitle">
              <el-input v-model="form.maintitle" placeholder="请输入案卷题名" />
            </el-form-item>
            <el-form-item label="归档时间" prop="pigeonholeDate">
              <el-input v-model="form.pigeonholeDate" placeholder="请输入归档时间" />
            </el-form-item>
            <el-form-item label="形成年度" prop="filingYear">
              <el-input v-model="form.filingYear" placeholder="请输入形成年度" />
            </el-form-item>
            <el-form-item label="分类号" prop="archiveCtgNo">
              <el-input v-model="form.archiveCtgNo" placeholder="请输入分类号" />
            </el-form-item>

          </el-col>

          <el-col :span="6">
            <!-- 第二列-->
            <el-form-item label="案卷号" prop="yearFolderNo" >
              <el-input v-model="form.yearFolderNo" placeholder="请输入案卷号"/>
            </el-form-item>
            <el-form-item label="卷标" prop="dj" >
              <el-input v-model="form.dj" placeholder="请输入卷标"
              />
            </el-form-item>
            <el-form-item label="案卷数" prop="gj" >
              <el-input v-model="form.gj" placeholder="请输入案卷数"
              />
            </el-form-item>
            <el-form-item label="密级" prop="securityClass" >
              <el-select v-model="form.securityClass" placeholder="请选择密级" clearable>
                <el-option v-for="dict in dict.type.security_dict" :key="dict.value" :label="dict.label" :value="dict.value"/>
              </el-select>
            </el-form-item>
            <el-form-item label="保存期限" prop="retention" >
              <el-select v-model="form.retention" placeholder="请选择保存期限" clearable>
                <el-option
                  v-for="dict in dict.type.save_dict"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="文件数量" prop="quantity" >
              <el-input v-model="form.quantity" placeholder="请输入文件数量"/>
            </el-form-item>


          </el-col>

          <el-col :span="6">
            <!-- 第三列-->
            <el-form-item label="形成单位" prop="xcdw" >
              <el-input v-model="form.xcdw" placeholder="请输入形成单位"/>
            </el-form-item>
            <el-form-item label="移交单位" prop="yjdw" >
              <el-input v-model="form.yjdw" placeholder="请输入移交单位"/>
            </el-form-item>
            <el-form-item label="项目地址" prop="xmdz" >
              <el-input v-model="form.xmdz" placeholder="请输入项目地址"/>
            </el-form-item>
            <el-form-item label="编制日期" prop="bzrq" >
              <el-date-picker
                v-model="form.bzrq"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择编制日期">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="文字材料张数" prop="wjcl" >
              <el-input v-model="form.wjcl" placeholder="请输入文字材料张数"/>
            </el-form-item>
            <el-form-item label="蓝图张数" prop="ltzs" >
              <el-input v-model="form.ltzs" placeholder="请输入蓝图张数"/>
            </el-form-item>

          </el-col>

          <el-col :span="6">
            <!-- 第四列-->
            <el-form-item label="保存期限" prop="retention" >
              <el-input v-model="form.retention" placeholder="请输入保存期限"/>
            </el-form-item>
            <el-form-item label="全宗号" prop="fondsNo" >
              <el-input v-model="form.fondsNo" placeholder="请输入全宗号"/>
            </el-form-item>
            <el-form-item label="关键字" prop="sbtWord" >
              <el-input v-model="form.sbtWord" placeholder="请输入关键字"/>
            </el-form-item>
            <el-form-item label="档案馆代号" prop="dagdh" >
              <el-input v-model="form.dagdh" placeholder="请输入档案馆代号"/>
            </el-form-item>
            <el-form-item label="位置" prop="folderLocation" >
              <el-input v-model="form.folderLocation" placeholder="请输入位置"/>
            </el-form-item>
          </el-col>

        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listOld, getOld, delOld, addOld, updateOld } from "@/api/system/old";

export default {
  name: "Old",
  dicts: ['security_dict', 'save_dict'],
  data() {
    return {
      showAdvanceSearch: false,//初始时为简单搜索模式
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 旧案卷操作表格数据
      oldList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        folderNo: null,
        js: null,
        maintitle: null,
        folderLocation: null,
        securityClass: null,
        fondsNo: null,
        contentNo: null,
        filingYear: null,
        retention: null,
        archiveCtgNo: null,
        yearFolderNo: null,
        quantity: null,
        docStartTime: null,
        docEndTime: null,
        sbtWord: null,
        pigeonholeDate: null,
        note: null,
        archiveEntityStatus: null,
        ltzs: null,
        di: null,
        wjcl: null,
        xcdw: null,
        zjh: null,
        danr: null,
        xmdz: null,
        bzrq: null,
        yjdw: null,
        gj: null,
        dj: null,
        dagdh: null,
        nyr: null,
        xiangmdw: null,
        engId: null,
        yuliuA: null,
        yuliuB: null,
        yuliuC: null,
        yuliuD: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 高级搜索模式
    toggleSearchMode() {
      this.showAdvanceSearch = !this.showAdvanceSearch;
      setTimeout(() => {
        if (!this.showAdvanceSearch) {
          const searchForm = document.querySelector(".Search");
          if (searchForm) {
            searchForm.style.marginLeft = "";
          }
        }
      }, 0);
    },
    /** 查询旧案卷操作列表 */
    getList() {
      this.loading = true;
      listOld(this.queryParams).then(response => {
        this.oldList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        recid: null,
        folderNo: null,
        js: null,
        maintitle: null,
        folderLocation: null,
        securityClass: null,
        fondsNo: null,
        contentNo: null,
        filingYear: null,
        retention: null,
        archiveCtgNo: null,
        yearFolderNo: null,
        quantity: null,
        docStartTime: null,
        docEndTime: null,
        sbtWord: null,
        pigeonholeDate: null,
        note: null,
        archiveEntityStatus: null,
        ltzs: null,
        di: null,
        wjcl: null,
        xcdw: null,
        zjh: null,
        danr: null,
        xmdz: null,
        bzrq: null,
        yjdw: null,
        gj: null,
        dj: null,
        dagdh: null,
        nyr: null,
        xiangmdw: null,
        engId: null,
        yuliuA: null,
        yuliuB: null,
        yuliuC: null,
        yuliuD: null
      };
      this.resetForm("form");
    },
    //点击行触发，选中或不选中复选框
    handleRowClick (row, column, event) {
      this.$refs.multipleTable.toggleRowSelection(row);
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.recid)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加旧案卷操作";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const recid = row.recid || this.ids
      getOld(recid).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改旧案卷信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.recid != null) {
            updateOld(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addOld(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const recids = row.recid || this.ids;
      this.$modal.confirm('是否确认删除旧案卷操作编号为"' + recids + '"的数据项？').then(function() {
        return delOld(recids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/old/export', {
        ...this.queryParams
      }, `old_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
